package com.loie.xcx.service.impl;

import com.loie.xcx.mapper.ItemMapper;
import com.loie.xcx.model.bo.ItemBO;
import com.loie.xcx.model.bo.PermissionBO;
import com.loie.xcx.model.dto.QuotationQueryDTO;
import com.loie.xcx.service.ItemService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author zhl
 */
@Service
@AllArgsConstructor
@Transactional(rollbackFor = Exception.class)
public class ItemServiceImpl implements ItemService {
    final ItemMapper itemMapper;

    @Override
    public ItemBO getItemById(String itemId) {
        return itemMapper.getItemById(itemId);
    }

    @Override
    public ItemBO getItemNoAndClassItemNoByRecordId(String recordId) {
        return itemMapper.getItemNoAndClassItemNoByRecordId(recordId);
    }

    @Override
    public int updateItemByQrCode(String recordId, byte[] qrCode) {
        return itemMapper.updateItemByQrCode(recordId, qrCode);
    }

    @Override
    public ItemBO getItemByIdandPermissions(List<PermissionBO> permissionBOList, String itemNo) {
        return itemMapper.getItemByIdandPermissions(permissionBOList,itemNo);
    }

    @Override
    public List<ItemBO> getItemByPermissionslist(List<PermissionBO> permissionBOList, QuotationQueryDTO quotationQueryDTO) {
        return itemMapper.getItemByPermissionslist(permissionBOList,quotationQueryDTO);
    }
}
